<?php
namespace App\Service\OrderService\OrderInterfaceService;

use App\Service\BaseService;
use App\Service\Code\Normal;
use App\Service\Sms\SendSmsCode;
use App\Model\PssModel\MerchantAdress;

/**
 * 百大其它附属服务
 * @author chenshubo
 */
class BbExtraCenter extends BaseService
{
    /**
     * 短信发送
     * @param array $param['mobile']
     * @param array $param['messasge']
     */
    public function sendSmsCode(array $body)
    {
        $param = $body['requestData'];
        if( empty($param['mobile']) ) {
            return Normal::returnCode(Normal::FAIL,"发送短信mobile手机号码不能为空");
        }
        
        if( empty($param['messasge']) ) {
            return Normal::returnCode(Normal::FAIL,"发送短信messasge消息体不能为空");
        }
        
        return SendSmsCode::instance()->sendSmsCodeByContents((string)$param['mobile'],(string)$param['messasge']);
    }

    /**
     * 腾讯二要素验证
     * @param array $body['requestData'=>['name'=>'蔡徐坤','idcard'=>'666666']]
     */
    public function idCardVerify(array $body){
        $param = $body['requestData'];
        if(!isset($param['name']) || empty($param['name']) ) {
            return Normal::returnCode(Normal::FAIL,"二要素验证name不能为空");
        }
        if(!isset($param['idcard']) || empty($param['idcard']) ) {
            return Normal::returnCode(Normal::FAIL,"二要素验证idcard不能为空");
        }
        return MerchantAdress::instance()->idcardauth(['name' => $param['name'], 'idNum' => $param['idcard']]);
    }
}